package vfs.persist.association;

import vfs.obj.entity.VFSUser;
import vfs.obj.entity.VFSNode;
import vfs.filter.VFSFilter;
import java.util.Iterator;

/**
 * VFSUserToHomeDirectory manages the relationship 
 * between Users and their home directories (Nodes)
 * in the storage medium.
 * 
 * @author Matthew Eavenson <durandal@uga.edu>
 */
public interface VFSUserToHomeDirectoryManager{
    
    /**
     * Returns an iterator over all users who have a given home directory,
     * and filtered by a specified filter.
     * 
     * @param node the home directory of potentially multiple users
     * @param filter a filter over the users who have the given home directory
     * @return an iterator over any matching users
     */
    Iterator<VFSUser> getUsers(VFSNode node, VFSFilter filter);
    
    /**
     * Returns a user's home directory.
     * 
     * @param user the user whose home directory we are requesting
     * @return the user's home directory
     */
    VFSNode getHomeDirectory(VFSUser user);
    
    /**
     * Sets the home directory for a specified user.
     * 
     * @param user the user whose home directory is to be set
     * @param directory the new home directory
     */
    void setHomeDirectory(VFSUser user, VFSNode directory);
    
}